package cic;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class ReportWindow {

	private JFrame frame;
	private JLabel label1;
	private JLabel label2;
	private JTextField txt1;
	private JTextField txt2;
	private JButton btn1;
	private JButton btn2;
	private JButton btn3;
	private boolean submitted;
	
	public ReportWindow() {
		
		frame = new JFrame("Report a claim");
		label1 = new JLabel("REPORTER\'S NAME", JLabel.CENTER);
		label2 = new JLabel("INSURANCE No.", JLabel.CENTER);
		txt1 = new JTextField();
		txt2 = new JTextField();
		btn1 = new JButton("Web Form");
		btn2 = new JButton("SMS");
		btn3 = new JButton("E-mail");
		submitted = false;
		
		btn1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setSubmitted(true);
			}
		});
		
		btn2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setSubmitted(true);
			}
		});
		
		btn3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setSubmitted(true);
			}
		});
		
		frame.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent arg0) {
				System.exit(1);
			}
		});
		
		frame.setLayout(new GridLayout(4, 2, 5, 5));
		frame.add(label1);
		frame.add(txt1);
		frame.add(label2);
		frame.add(txt2);
		frame.add(btn1);
		frame.add(btn2);
		frame.add(btn3);
		
		
		frame.pack();
		Point pt = new Point(700, 200);
		Dimension dm = new Dimension(300, 300);
		frame.setLocation(pt);
		frame.setSize(dm);
		frame.setVisible(true);
				
	}
	
	public void setSubmitted(boolean sub) {
		this.submitted = sub;
	}
	
	public boolean isSubmitted() {
		if (submitted == true) {
			return true;
		} else {
			return false;
		}
	}
	
	public String getCustomer() {
		return txt1.getText();
	}
	
	public String getNum() {
		return txt2.getText();
	}
	
	public void setCustomer(String cust) {
		txt1.setText(cust);
	}
	
	public void setNum(String num) {
		txt2.setText(num);
	}
	
	public void hide(boolean tag) {
		frame.setVisible(!tag);
	}
	
}
